<?php

namespace Sifast\ProjectBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;

class CompetencesAdmin extends Admin
{
 
    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
        ->with('L1')
            ->add('natureCompetence','text',array(
                'label'=> 'Nature de compétence:',))
            ->add('niveauCompetence','text',array(
                'label'=> 'Niveau de compétence:',))
        ->end() 
        ->with('L2')        
            ->add('anneeExperience', 'choice', array(
                    'label'=> "Année d'éxperience:",
                    'choices' => array(
                        'Matinée' => 'Matinée',)))
            ->add('dateDerniereEvaluation', 'date', array(
                    'label'=> 'Date derniére évaluation:',
                    'widget' => 'single_text',
                    'format' => 'MM/dd/yyyy',
                    'attr' => array('class' => 'datepicker')
                ))
        ->end()
        ->with('L3')        
            ->add('dateDerniereValidation', 'date', array(
                    'label'=> 'Date derniére validation:',
                    'widget' => 'single_text',
                    'format' => 'MM/dd/yyyy',
                    'attr' => array('class' => 'datepicker')
                ))
            ->add('dateProchaineEvaluation', 'date', array(
                    'label'=> 'Date prochine évaluation:',
                    'widget' => 'single_text',
                    'format' => 'MM/dd/yyyy',
                    'attr' => array('class' => 'datepicker')
                ))
       ->end()
       ->with('L4')         
            ->add('dateProchaineValidation', 'date', array(
                    'label'=> 'Date prochiane validation:',
                    'widget' => 'single_text',
                    'format' => 'MM/dd/yyyy',
                    'attr' => array('class' => 'datepicker')
                ))
       ->end()    ;
            
    }

    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
    {
        $datagridMapper
            ->add('natureCompetence')
            ->add('niveauCompetence')
            ->add('anneeExperience')
            ->add('dateDerniereEvaluation') 
            ->add('dateDerniereValidation')
            ->add('dateProchaineEvaluation')
            ->add('dateProchaineValidation')
            ;
            
    }

    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper
            ->addIdentifier('natureCompetence')
            ->add('niveauCompetence')
            ->add('anneeExperience')
            ->add('dateDerniereEvaluation') 
            ->add('dateDerniereValidation')
            ->add('dateProchaineEvaluation')
            ->add('dateProchaineValidation')
            ;
            
            }
}